import request from '../instance'
import { API_ROUTES } from '../config'

export interface FamilyPreferences {
  spicyLevel: number
  allergies: string[]
  dietaryRestrictions: string[]
}

export interface FamilyInfo {
  id: string
  name: string
  memberCount: number
  hasChildren: boolean
  hasElderly: boolean
  preferences: FamilyPreferences
}

export const familyApi = {
  // 获取家庭信息
  getFamily: (familyId: string) => {
    return request.get<any, FamilyInfo>(API_ROUTES.GET_FAMILY(familyId))
  },

  // 创建家庭
  createFamily: (data: Omit<FamilyInfo, 'id'>) => {
    return request.post<any, FamilyInfo>(API_ROUTES.CREATE_FAMILY, data)
  },

  // 更新家庭信息
  updateFamily: (familyId: string, data: Partial<FamilyInfo>) => {
    return request.put<any, FamilyInfo>(API_ROUTES.UPDATE_FAMILY(familyId), data)
  }
}